package com.zw.a.basic.a13.demo14_model;

//生产者类(Producer)：实现Runnable接口，重写run()方法，调用存储牛奶的操作
public class Producer implements Runnable {
    //定义一个变量, 记录共享区域的引用.
    private Box b;

    public Producer(Box b) {
        this.b = b;
    }

    //里边写的是: 具体的存储牛奶的操作
    @Override
    public void run() {
        for (int i = 1; i <= 30; i++) {
            b.put(i);
        }
    }
}
